package com.easylinkin.linkappapi.deviceparm.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author TongJie
 * @since 2020-04-15
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("linkapp_device_parm")
@ApiModel("设备参数实体类")
public class DeviceParm extends Model<DeviceParm> {

    private static final long serialVersionUID = 1L;

    @TableId("id")
    @ApiModelProperty("主键ID")
    private String id;

    @TableField("device_service_id")
    @ApiModelProperty("设备服务ID")
    private String deviceServiceId;

    @TableField("identifier")
    @ApiModelProperty("参数定义")
    private String identifier;

    @ApiModelProperty("参数名称")
    @TableField("name")
    private String name;

    @ApiModelProperty("值")
    @TableField("value")
    private String value;

    @ApiModelProperty("版本号")
    @TableField("version")
    private String version;

    @ApiModelProperty("父ID")
    @TableField("parent_id")
    private String parentId;

    /**
     * 单位
     */
    @ApiModelProperty("单位")
    @TableField("unit")
    private String unit;

    @ApiModelProperty("规范")
    @TableField("specs")
    private String specs;

    @ApiModelProperty(value = "排序", required = false, example = "0")
    @TableField("sort_no")
    private Integer sortNo;

    @ApiModelProperty("描述")
    @TableField("description")
    private String description;

    @TableField("create_time")
    private Date createTime;

    @TableField("creator")
    private String creator;

    @TableField("modifier")
    private String modifier;

    @TableField("modify_time")
    private Date modifyTime;

    @TableField(exist = false)
    private List<DeviceParm> childParamList;

    @TableField(exist = false)
    private Integer arrayIndex;

    public DeviceParm() {
    }

    public DeviceParm(String deviceParmId, String parmValue) {
        this.id = deviceParmId;
        this.value = parmValue;
    }

    public DeviceParm(String deviceParmId, String parmValue, String unit, String specs, Integer arrayIndex) {
        this.id = deviceParmId;
        this.value = parmValue;
        this.unit = unit;
        this.specs = specs;
        this.arrayIndex = arrayIndex;
    }

    public DeviceParm(String identifier, String value, String unit, Integer arrayIndex) {
        this.identifier = identifier;
        this.value = value;
        this.unit = unit;
        this.arrayIndex = arrayIndex;
    }




    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
